﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Web.Security;
using System.Data;
using System.Web.Script.Services;

namespace DelonixRegia.Classes
{
    public class ClientScriptMgr
    {
        public static void Execute(string script)
        {
            Page currentPage = (Page)HttpContext.Current.CurrentHandler;
            currentPage.ClientScript.RegisterStartupScript(currentPage.GetType(), "ClientScriptExecute", script, true);
        }

        public static void showErrorBox(string errorMsg)
        {
            Page currentPage = (Page)HttpContext.Current.CurrentHandler;
            currentPage.ClientScript.RegisterStartupScript(currentPage.GetType(), "ClientScriptExecute", "$('#errorBox').html('<strong>Error:</strong> " + errorMsg + "');$('#errorBox').hide().show();", true);
        }

        public static void showSuccessBox(string successMsg)
        {
            Page currentPage = (Page)HttpContext.Current.CurrentHandler;
            currentPage.ClientScript.RegisterStartupScript(currentPage.GetType(), "ClientScriptExecute", "$('#successBox').html('<strong>Success:</strong> " + successMsg + "');$('#successBox').hide().show();", true);
        }
    }
}